package com.bracketbird.client.gui.club.tournament;


import com.bracketbird.client.gui.pages.*;
import com.bracketbird.client.model.*;
import com.google.gwt.user.client.*;
import com.bracketbird.clientcore.appcontrol.*;
import com.bracketbird.clientcore.gui.*;

/**
 *
 */
public class ViewResultsPageController extends PageController<ViewResultsPage> {

    private static ViewResultsPageController instance;
    public static String HISTORY_NAME = "viewresults";

    private Timer t;

    private ViewResultsPageController() {
        super(MainPageController.getInstance(), HISTORY_NAME);
    }

    public static ViewResultsPageController getInstance() {
        if (instance == null) {
            instance = new ViewResultsPageController();
        }
        return instance;
    }

    public void afterLoad(){
        super.afterLoad();
        t = new Timer() {
            @Override
            public void run() {
                //Service.getTournamentChanges();
            }
        };
        //each 5 s. checking for changes on server
        t.scheduleRepeating(1000*5);

    }

    public MenuComponent getMenu() {
        return null;
    }

    public ViewResultsPage newInstance() {
        return new ViewResultsPage();
    }

    public boolean makeHistory() {
        return true;
    }

    public MenuComponent newMenuInstance() {
        return new MenuLinkComponent("");
    }

    public UserStateConstant getLegalState() {
        return UserStateConstant.LOGGED_OUT;
    }
}